package com.taobao.pamirs.schedule.job;

import com.taobao.pamirs.schedule.TaskItemDefine;

import java.text.SimpleDateFormat;
import java.util.*;

/**
 * Created by yangwenchang on 2017/4/16.
 */
public class TestJob extends AbstractTaskDealMulti<Map>{

    //@Override
    public Comparator<Map> getComparator() {
        return null;
    }

    @Override
    protected boolean handleTask(Map[] var1, String var2) throws Exception {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        for (Map map:var1) {
            System.out.println(sdf.format(new Date())+"---"+map.get("taskItemList"));
        }


        return true;
    }

    @Override
    protected List<Map> queryTasks(String var1, String var2, int var3, List<TaskItemDefine> var4, int var5) throws Exception {
        List<Map> list = new ArrayList<Map>();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        for (int i = 0; i < 1; i++) {
            Map<String ,String> map = new HashMap<String, String>();
            //map.put("time",""+System.currentTimeMillis());
            String taskItemList = "";
            for (TaskItemDefine item:var4) {
                taskItemList= taskItemList+item.getTaskItemId()+",";
            }
            map.put("taskItemList",taskItemList.substring(0,taskItemList.length()-1));
            System.out.println(sdf.format(new Date())+"---"+map.get("taskItemList"));
            //list.add(map);
        }
        return list;
    }
}
